﻿using System.Collections.Generic;
using BakalarskaPraca.Forms;
using BakalarskaPraca.Generation.Tasks.Abstract;
using ColladaDotNet;
using ColladaDotNet.Geometry;

namespace BakalarskaPraca.Generation.Tasks
{
    class GeometryLoader : WorkTask
    {
        public GeometryLoader(ReportProgress reporter, string taskName) : base(reporter, taskName)
        {
        }

        public Dictionary<string, Geometry> LoadGeometries(ColladaDocument document)
        {
            int size = document.Geometries.Count;
            int loaded = 0;
            var result = new Dictionary<string, Geometry>();
            document.Geometries.ForEach(geometry =>
                                            {
                                                result.Add(geometry.Id, geometry);
                                                this.ReportProgressState(loaded++, size);
                                            });
            return result;
        }
    }
}
